<script>
import dmbForm from '@/components/DmbForm'
import { batchManualTakedownAPI } from '@/api/delivery/manual-takedown.js'
import { defaultForm, formBase, formItemStyle } from './config'
export default {
  name: "manual-takedown",
  computed: {
    formItemStyle() {
      return formItemStyle;
    },
    orderNoList() {
     return this.orderNumbers.split("\n").filter(el => ! /^\s+$/.test(el) )
    },
  },
  data() {
    return {
      propsSearchForm: { ...defaultForm },
      orderNumbers: '',
    };
  },
  components: { dmbForm },
  methods: {
    formBase() {
      return formBase;
    },
    // 下架
    putAway() {
      console.log(this.orderNoList,1);
      if(!this.orderNoList.length || !this.orderNoList[0]) return this.$message.error('请输入单号')
      batchManualTakedownAPI(this.orderNoList).then(() => {
        this.$message.success("下架成功!");
      });
    },
    reset(){
      this.orderNumbers = ''
    }
  },
};
</script>

<template>
  <div  >
    <div class="w-[650px]  flex ">
      <el-input
        :autosize="{ minRows: 16, maxRows: 30 }"
        type="textarea"
        placeholder="请输入单号"
        v-model="orderNumbers"
      >
      </el-input>
      <div   class="ml-4">
    <el-button  type="primary" @click="reset">清空</el-button>
    <el-button   class="mt-20"   type="primary" @click="putAway">单个/批量下架</el-button>
      </div>
    </div>
  </div>
</template>

<style scoped lang="scss">
</style>
